package com.kinptm.masterclock.bean;

import android.content.Context;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import org.joda.time.DateTime;

import java.util.TreeSet;

@DatabaseTable
public class AlarmClock extends AlarmRang {
    @DatabaseField
    private long alarmMillis;
    @DatabaseField(dataType = DataType.SERIALIZABLE)
    private TreeSet<Integer> repeat;

    public AlarmClock(){}
    public AlarmClock(Context context) {
        super(context);
        repeat = new TreeSet<Integer>();
        alarmMillis = DateTime.now().withTime(0, 0, 0, 0).getMillis();
        enable = true;
        vibrate = true;
    }

    @Override
    public String toString() {
        return "AlarmClock{" +
                "alarmMillis=" + alarmMillis +
                ", repeat=" + repeat +
                "} " + super.toString();
    }

    public long getAlarmMillis() {
        return alarmMillis;
    }

    public void setAlarmMillis(long alarmMillis) {
        this.alarmMillis = alarmMillis;
    }

    public TreeSet<Integer> getRepeat() {
        return repeat;
    }

    public void setRepeat(TreeSet<Integer> repeat) {
        this.repeat = repeat;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof AlarmClock)) return false;

        AlarmClock that = (AlarmClock) o;

        if (id != that.id) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return id;
    }
}
